Skip to content

fix(scout-for-lol): open the narrow-width tooltip sheet from the keyboard - #5561

Open
shepherdjerred wants to merge 1 commit into
mainfrom
scout-tooltip-sheet-keyboard
Open

shepherdjerred wants to merge 1 commit into
mainfrom
scout-tooltip-sheet-keyboard

Conversation

@shepherdjerred

@shepherdjerred shepherdjerred commented Dec 3, 2026 •

Copy link
Copy Markdown
Owner

Why

Under 640px a tooltip opens as a bottom sheet, but only a click opened it. Page-rendered triggers from #5548 (setup items, later-game items, recent-change labels) are spans and list items with a tabindex, which produce no click from Enter or Space, so a keyboard user below 640px could not open them (AI-1225, found in the review of #5548). On desktop the same trigger opens its layer on focus and moves into it on Enter, Space or ArrowRight.

What

  • rich-tooltip-sheet.tsx: the sheet gets a key rule next to its click rule. Enter or Space on a trigger that does not click natively opens the sheet. Links, buttons and other natively activated triggers stay with their click, so the sheet opens once. The same rules object feeds a rendered trigger (onKeyDown) and a page-rendered one (useTriggerListeners), as the click rule already did.
  • rich-tooltip-external.ts: opensSheet (the pure key decision) and isNativelyActivated.
  • Opening moves focus into the sheet (Radix dialog); Escape closes it and returns focus to the trigger (the existing onCloseAutoFocus).
  • Links keep their two-step behaviour: the delegated island already pins a page-rendered link to the popover on a phone, so focus shows its layer, ArrowRight enters it, Escape returns, and Enter on the link follows it. That path is now covered at 390px.
  • README: the keyboard behaviour of the sheet.

Deviation from the brief: the sheet has no timers (the hover controller is not involved), so the unit tests cover the pure key rule in rich-tooltip-external.test.ts rather than using fake timers; the timing is untouched.

Demo

Behaviour change with no visual change, so the evidence is the 390px keyboard e2e (rich-tooltip.spec.ts, phone group). With the key rule disabled the page-rendered case fails; with it, it passes:

Before (key rule disabled)
  ✘ phone › a keyboard opens the sheet from a page-rendered trigger, focus moves in and Escape returns it (5.3s)
      Error: expect(locator).toBeVisible() failed   (the Malignance sheet never opens on Enter)
  ✓ phone › a keyboard opens the sheet from a rendered trigger and Escape returns focus to it

After
  ✓ phone › a keyboard opens the sheet from a page-rendered trigger, focus moves in and Escape returns it
  ✓ phone › a link takes the layer on focus and the second activation follows it
  ✓ phone › a keyboard opens the sheet from a rendered trigger and Escape returns focus to it

Verification

  • bunx turbo run build typecheck test lint --filter='...@scout-for-lol/design-system': green (design-system 212 tests, frontend 129, scout-for-lol 115).
  • bunx turbo run test:e2e --filter=@scout-for-lol/design-system: 1230 passed, including the three new 390px keyboard tests (page-rendered trigger with Enter and with Space, a page-rendered link, a rendered RichTooltip trigger). Re-run after the rebase on origin/main: the 13 rich-tooltip tests pass.
  • bun run jscpd (baseline ratchet passed), bun run check-directory-file-counts, bunx lefthook run pre-commit: pass.
  • Extended tier: no affected workspace has tier: "extended" steps.
  • Design-audit goldens not regenerated: nothing renders differently (a key handler and no markup change), so the pinned ci-playwright baselines stay valid; CI's design-audit run is the check.
  • Not run: live deployment.

🤖 Generated with Claude Code

https://claude.ai/code/session_011u9pQk6p4o3DxofkiZXg8y

…oard

Why
Under 640px a tooltip opens as a bottom sheet, but only a click opened it.
Page-rendered triggers (setup items, later-game items, recent-change labels)
are spans and list items with a tabindex, which produce no click from Enter or
Space, so a keyboard user below 640px could not open them (AI-1225, found in
review of #5548). The desktop layer opens on focus and moves in on Enter,
Space or ArrowRight.

What
- The sheet now has a key rule: Enter or Space on a trigger that does not click
  natively opens the sheet. Links, buttons and other natively activated
  triggers stay with their click so the sheet opens once.
- The rule is shared by a rendered trigger (onKeyDown) and a page-rendered one
  (DOM listener), as the click rule already was. Opening moves focus into the
  sheet; Escape closes it and returns focus to the trigger.
- A page-rendered link stays a popover on a phone, so focus shows its layer,
  ArrowRight enters it and Enter follows the link.
- Unit tests for the key rule; Playwright e2e at 390px for the page-rendered
  trigger (Enter and Space), the link, and a rendered trigger.

Verification
- bunx turbo run build typecheck test lint --filter='...@scout-for-lol/design-system': green
- bunx turbo run test:e2e --filter=@scout-for-lol/design-system: 1230 passed
- the page-rendered e2e fails with the key rule disabled
- bun run jscpd, check-directory-file-counts, lefthook pre-commit: pass
- Not run: design-audit goldens (no rendered change), live deployment

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011u9pQk6p4o3DxofkiZXg8y
@shepherdjerred

Copy link
Copy Markdown
Owner Author

This change is part of the following stack:

Change managed by git-spice.

@greptile-apps

greptile-apps Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Automatic reviews are disabled for this repository. Configure in Code Review Settings.

@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@shepherdjerred
shepherdjerred marked this pull request as ready for review December 3, 2026 08:49
@shepherdjerred

Copy link
Copy Markdown
Owner Author

@codex review

Automated re-review request for cbb0266 from the CI review gate.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-03T08:53:19.272681Z cbb0266 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: cbb0266df8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant